<template>
  <view>
    <course-list :coures="courses" @itemClick="goDeailList"></course-list>
  </view>
</template>

<script>
import { courses } from "../../api/api.js";
export default {
  data() {
    return {
      courses: [],
    };
  },
  onLoad() {
    this.fetchList();
  },
  methods: {
    goDeailList(id) {
      uni.navigateTo({
        url: `/pages/course-detail-list/course-detail-list?id=${id}`,
      });
    },
    async fetchList() {
      let rs = await courses();
      this.courses = rs.data;
    },
  },
};
</script>

<style></style>
